package com.xyb.controller;

import com.xyb.entity.BizChart;
import com.xyb.service.WebChartService;
import com.xyb.vo.BizChartVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("web")
public class WebController {
    @Resource
    private WebChartService webChartService;

    @GetMapping("charts")
    public List<BizChartVo> selectBizChart(){
        List<BizChart> charts = webChartService.selectBizChart();
        List<BizChartVo> list = new ArrayList<>();
        charts.forEach(i->{
            list.add(new BizChartVo(i.getChartId(),i.getChartUrl(),i.getLinkUrl()));
        });
        return list;
    }
}
